package com.turing.pre.processor.enums;

import lombok.Getter;

/**
 * @author livin
 * @version V1.0
 * @date 2021/4/15 11:30
 * @Copyright © 2020 Shenzhen Turing robot Co., Ltd
 */
public enum AnalysisStatusEnum {

    /**
     * 为转换
     */
    INACTIVE(0, "inactive"),

    /**
     * 等待elec PDF到json
     */
    WAITINGSPLITING(1, "waiting elec pdf to json"),
    /**
     * 电子pdf文本分析
     */
    WAITINGELECTEXTANALYSING(2, "elec pdf text analysing"),
    /**
     * json汇编
     */
    WAITINGJSONASSEMBLING(3, "json assembling"),

    /**
     * 表格转json完成
     */
    ELEC2JSONFINISHED(4, "belongsElec to json finished"),

    /**
     * 错误
     */
    ERROR(5, "error");

    @Getter
    private Integer code;

    @Getter
    private String name;

    AnalysisStatusEnum(Integer code, String name) {

        this.code = code;
        this.name = name;

    }

    public static AnalysisStatusEnum getEnum(Integer index) {

        AnalysisStatusEnum[] statusEnums = AnalysisStatusEnum.values();
        for (AnalysisStatusEnum anStatusEnum : statusEnums) {
            if (index.equals(anStatusEnum.getCode())) {
                return anStatusEnum;
            }
        }
        return null;

    }

}
